<template>
	<view>
		<view class="state_box">{{ orderInfo.state == 0 ? '待审核' : '已审核' }}</view>
		<view class="content_box">
			<image :src="orderInfo.imgUrl" mode=""></image>
			<view class="content_right">
				<view class="title_box">
					<text>{{ orderInfo.title }}</text>
					<text>￥{{ orderInfo.price }}/份</text>
				</view>
				<view class="text_box">导演：{{ orderInfo.director }}</view>
				<view class="text_box line-1">{{ orderInfo.introduce }}</view>
				<view class="sale_box">
					<u-line-progress
						:active-color="orderInfo.sale >= 100 ? '#D5D6DC' : '#EC5F58'"
						:percent="orderInfo.sale"
						inactive-color="#FFEBEA"
						:show-percent="false"
						height="34"
					></u-line-progress>
					<view class="sale_number" :style="'color:' + (orderInfo.sale >= 100 ? '#D5D6DC' : '#F1736D')">
						{{ orderInfo.sale >= 100 ? '已售罄' : '已售' + orderInfo.sale + '%' }}
					</view>
				</view>
			</view>
		</view>
		<view class="order_info">
			<view class="order_item">
				<text>订单编号</text>
				<text>20201104105203463</text>
			</view>
			<view class="order_item">
				<text>购买份数</text>
				<text>3份</text>
			</view>
			<view class="order_item">
				<text>支付金额</text>
				<text class="price">￥15000</text>
			</view>
			<view class="order_item">
				<text>上传图片</text>
				<view class="slot-btn" v-if="orderInfo.state == 1">
					<image src="../../static/myImage/user.png" mode=""></image>
				</view>
				<u-upload v-else
					action="" 
					:file-list="[]" 
					max-count="1" 
					:auto-upload="false" 
					upload-text="" 
					:custom-btn="true" 
					width="150"
					height="150">
					<view class="slot-btn" slot="addBtn">
						<image src="../../static/myImage/upload.png" mode=""></image>
					</view>
				</u-upload>
			</view>
		</view>
		
		<button type="default" class="btn" v-if="orderInfo.state == 0" @click="cancelOrder">取消订单</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			orderInfo: {},
			otherInfo: {}
		};
	},
	methods: {
		cancelOrder() {
			console.log('取消订单')
		}
	},
	onLoad(options) {
		this.orderInfo = JSON.parse(options.info);
		this.orderInfo.price = 5000;
	}
};
</script>

<style lang="scss" scoped>
.state_box {
	font-size: 32upx;
	font-weight: bold;
	padding-bottom: 40upx;
}

.content_box {
	margin-bottom: 30upx;
	padding: 30upx 20upx;
	box-shadow: 0px 4upx 10upx 0px rgba(4, 0, 0, 0.1);
	border-radius: 10upx;
	display: flex;
	justify-content: space-between;
	align-items: center;
	image {
		width: 180upx;
		height: 235upx;
		border-radius: 15upx;
		margin-right: 20upx;
	}
	.content_right {
		flex: 1;
		.text_box {
			font-size: 30upx;
			color: $color-666;
			margin-bottom: 30upx;
		}
		.line-1 {
			max-width: 400upx;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
		.title_box {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 30upx;
			text {
				font-size: 32upx;
				&:last-child {
					color: $red;
					font-size: 34upx;
					font-weight: bold;
				}
			}
		}
		.sale_box {
			display: flex;
			align-items: center;
			width: 100%;
			.sale_number {
				flex: 1;
				margin-left: 20upx;
				white-space: nowrap;
				font-size: 26upx;
			}
		}
	}
}

.order_info {
	margin-bottom: 30upx;
	padding: 40upx 30upx;
	box-shadow: 0px 4upx 10upx 0px rgba(4, 0, 0, 0.1);
	border-radius: 10upx;
	.order_item {
		margin-bottom: 40upx;
		display: flex;
		justify-content: space-between;
		font-size: 30upx;
		&:last-child {
			margin-bottom: 0;
		}
		.price {
			color: $red;
		}
		.slot-btn {
			image {
				width: 150upx;
				height: 150upx;
			}
		}
	}
}

.btn {
	position: absolute;
	bottom: 40upx;
	left: 50%;
	transform: translate(-50%);
	width: 92%;
	height: 60upx;
	border-radius: 8upx;
	font-size: 32upx;
	line-height: 60upx;
	color: #ffffff;
	background: #373846;
	border: none;
	&::after {
		border: none;
	}
}
</style>

<style>
page {
	padding: 30upx;
}
</style>
